<template>
  <el-dialog title="出库申请" :visible="outboundVisible" :center="true" width="82%" @close="closeDialog" :close-on-click-modal="false">
    <el-row>
      <el-col>单位:{{ company }}</el-col>
      <el-col>日期:{{ date }}</el-col>
    </el-row>
    <el-table :data="outboundData" :border="true" size="mini">
      <el-table-column label="序号" type="index" min-width="5%"></el-table-column>
      <el-table-column label="名称" prop="name" min-width="15%"></el-table-column>
      <el-table-column label="物料编码" prop="code" min-width="10%"></el-table-column>
      <el-table-column label="规格/型号" prop="model" min-width="30%"></el-table-column>
      <el-table-column label="单位" prop="unit" min-width="5%"></el-table-column>
      <el-table-column label="数量" min-width="5%">
        <template slot-scope="scope">
          <el-input v-model="scope.row.number" size="mini"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="项目号" min-width="30%">
        <template slot-scope="scope">
          <el-input v-model="scope.row.project" size="mini"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="出库地点" prop="positionName" v-if=false></el-table-column>
    </el-table>
    <el-row>
      <el-col>领用人:{{ recipient }}</el-col>
      <el-col>审核:</el-col>
      <el-col>出库:</el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <el-input type="textarea" size="mini" rows="3" placeholder="请填写处理意见"
                  v-model="outboundComment"></el-input>
      </el-col>
    </el-row>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="applyOutbound" size="mini">确 定</el-button>
      <el-button type="primary" @click="cancle" size="mini">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "OutBound",
  props: {
    outboundVisible: Boolean,
    outboundData: Array,
    company: String,
    date: String,
    recipient: String,
    outboundComment:'',
  },
  methods: {
    applyOutbound() {
      this.outboundData.forEach(item => {
        item.recipient = this.recipient
      })
      const outboundInfo = {
        outboundMaterialDTOS: this.outboundData,
        approvalCommentDTO: {
          comment: this.outboundComment
        }
      }
      this.$emit('update', false)
      this.$emit('outboundApplied', outboundInfo)
    },
    cancle() {
      this.$emit('update', false)
    },
    closeDialog(){
      this.$emit('update', false)
    }
  },
}
</script>

<style scoped>

</style>